<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>签约信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <script src="/layui/jquery-3.5.1.min.js"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>

<body>

<!--<blockquote class="layui-elem-quote layui-text">
    鉴于小伙伴的普遍反馈，先温馨提醒两个常见“问题”：1. <a href="/doc/base/faq.html#form" target="_blank">为什么select/checkbox/radio没显示？</a> 2. <a href="/doc/modules/form.html#render" target="_blank">动态添加的表单元素如何更新？</a>
</blockquote>-->
<!--<h3 th:text="${dictionary.getvalue()}"></h3>-->
<!-- <option th:each="suppiler:${suppilers}" th:value="${suppiler.id}" th:text="${suppiler.name}"></option>-->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>客户产品演示</legend>
</fieldset>

<form class="layui-form" action="/customerInformation/addSigningInformation" method="post">
 <input name="supplier.id" type="hidden"  th:value="${customerId}">
<!-- <input name="supplier.id" type="hidden"  th:value="${supplier.products.id}">-->
    <div class="layui-form-item">
        <label class="layui-form-label">企业名称</label>
        <div class="layui-input-inline">
            <input id="supplierName" th:value="${supplier.name}" type="text" name="supplier.id" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">简称</label>
        <div class="layui-input-inline">
            <input th:value="${supplier.abbreviation}" type="text" readonly="readonly" name="department" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-inline">
            <input th:value="${supplier.address}" type="text" readonly="readonly" name="post" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">法定代表人</label>
        <div class="layui-input-inline">
            <input th:value="${supplier.legalRepresentative}" type="text" readonly="readonly" name="content" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
    <labeld  class="layui-form-label">委托代理人</labeld>
    <div class="layui-input-inline">
        <select name="agent.id"  lay-search="">
            <option value="0">直接选择或搜索选择</option>
               <option th:each="agent:${supplier.agents}" th:value="${agent.id}" th:text="${agent.name}"/>
        </select>
    </div>
    </div>
    <div class="layui-inline">
    <labeld  class="layui-form-label">业务联系人</labeld>
    <div class="layui-input-inline">
        <select id="businessContact" lay-filter="businessContact"  name="businessContact.id"  lay-search="">
            <option value="0">直接选择或搜索选择</option>
            <option th:each="businessContact:${supplier.businessContacts}" th:value="${businessContact.id}" th:text="${businessContact.name}"/>
        </select>
    </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">业务电话</label>
        <div class="layui-input-inline">
            <input id="phone" type="text" readonly="readonly" name="quota" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">业务邮箱</label>
        <div class="layui-input-inline">
            <input id="email" type="text" readonly="readonly" name="quota" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">传真</label>
        <div class="layui-input-inline">
            <input id="fax" type="text" readonly="readonly" name="quota" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮编</label>
        <div class="layui-input-inline">
            <input id="postcode" type="text" readonly="readonly" name="quota" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">联系地址</label>
        <div class="layui-input-inline">
            <input id="address" type="text" readonly="readonly" name="quota" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <labeld  class="layui-form-label">开户行名称</labeld>
    <div class="layui-input-inline">
        <select id="account"  name="account.id" lay-filter="account"  lay-search="">
            <option value="">直接选择或搜索选择</option>
            <option th:each="account:${supplier.accounts}" th:value="${account.id}" th:text="${account.name}"></option>
        </select>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-inline">
            <input id="bankAccount" type="text" readonly="readonly" name="quota" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">税务登记号</label>
        <div class="layui-input-inline">
            <input th:value="${supplier.dutyParagraph}" type="text" readonly="readonly" name="quota" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <labeld  class="layui-form-label">品名</labeld>
    <div class="layui-input-inline">
        <select id="demand"  name="demand.id" lay-filter="demand"  lay-search="">
            <option value="">直接选择或搜索选择</option>
            <option th:each="demand:${supplier.demands}" th:value="${demand.id}" th:text="${demand.dictionaryB.value}"></option>
        </select>
    </div>
   <!-- <labeld  class="layui-form-label">品类</labeld>
    <div class="layui-input-inline">
        <select id="product"  name="product.id" lay-filter="product"  lay-search="">
            <option value="">直接选择或搜索选择</option>
            <option th:each="product:${supplier.products}" th:value="${product.dictionaryA.id}" th:text="${product.dictionaryA.value}"></option>
        </select>
    </div>-->
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea" name="remarks"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="submit" class="layui-btn" lay-submit="" lay-filter="demo1"/>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>



<script src="/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->

<script>
   /* layui.$(function () {
        $("#type1").change(function () {
            /!*var t = $(".type").val();*!/
            alert("1111");
        });
    });*/
</script>
<script>
    layui.use('upload', function() {
        var $ = layui.jquery
            , upload = layui.upload;
        //选完文件后不自动上传
        upload.render({
            elem: '#test8'
            ,url: 'http://localhost:8080/customerInformation/enterpriseBasicInformation' //改成您自己的上传接口
            ,auto: false
            ,accept: 'file'
            //,multiple: true
            ,bindAction: '#test9'
            ,done: function(res){
                layer.msg('上传成功');
                console.log(res)
            }
        });
    })
    layui.use(['form', 'layedit', 'laydate'], function() {
        var form = layui.form,
            layer = layui.layer,
            layedit = layui.layedit,
            laydate = layui.laydate;
            $ = layui.$;
        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });
        /*$("#businessContact").on(function () {*/
        form.on('select(account)', function (data) {
            //$(this).parents("fieldset").find(".startLocationhid").val(data.value);
            var id = $("#account").val();
            url = "/customerInformation/dataLista";
            accountId = id;
            $.ajax({
                url:url,
                type:'post',
                data:{"accountId":accountId},
                success:function(data)
                {
                    //dataL =  JSON.parse(data);
                    var json = JSON.stringify(data)
                    console.log(json);
                    // obj是对象
                    // var obj = jQuery.parseJSON(data)
                    var obj = JSON.parse(json);
                    $("#bankAccount").val(obj.bankAccount);
                }
            })

        })
        form.on('select(businessContact)', function (data) {
            //$(this).parents("fieldset").find(".startLocationhid").val(data.value);
            var id = $("#businessContact").val();

            url = "/customerInformation/dataList";
            businessContactId = id;
            $.ajax({
                url:url,
                type:'post',
                data:{"businessContactId":businessContactId},
                success:function(data)
                {
                   //dataL =  JSON.parse(data);
                    var json = JSON.stringify(data)
                    console.log(json);
                    // obj是对象
                    // var obj = jQuery.parseJSON(data)
                    var obj = JSON.parse(json);
                    $("#phone").val(obj.phone);
                    $("#address").val(obj.address);
                    $("#postcode").val(obj.postcode);
                    $("#fax").val(obj.fax);
                    $("#email").val(obj.email);
                }
            })

    })
        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');
        form.on('submit(demo1)', function(data) {
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭

        });
        //表单取值
        layui.$('#LAY-component-form-getval').on('click', function() {
            var data = form.val('example');
            alert(JSON.stringify(data));
        });

    });

</script>

</body>

</html>
</html>